Skip to content

Conversation

@ericcurtin
Copy link
Contributor

@ericcurtin ericcurtin commented Oct 11, 2025

To start, restart and stop container without pulling or removing the image.

Copilot AI review requested due to automatic review settings October 11, 2025 14:49
@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Oct 11, 2025

Reviewer's Guide

This PR refactors the install and uninstall runner commands to share common logic via new runnerOptions and cleanupOptions abstractions, introduces three new CLI commands (start-runner, stop-runner, restart-runner) that leverage the shared logic, and updates documentation to surface and describe these new commands and minor comment corrections.

Sequence diagram for restart-runner command execution

sequenceDiagram
    actor User
    participant CLI
    participant Docker
    User->>CLI: run restart-runner
    CLI->>Docker: stop runner container (no image/model removal)
    Docker-->>CLI: container stopped
    CLI->>Docker: start runner container (no image pull)
    Docker-->>CLI: container started
Loading

Class diagram for runnerOptions and cleanupOptions abstractions

classDiagram
    class runnerOptions {
        +uint16 port
        +string gpuMode
        +bool doNotTrack
        +bool pullImage
    }
    class cleanupOptions {
        +bool models
        +bool removeImages
    }
    class install_runner_command {
        +RunE(cmd, args)
    }
    class start_runner_command {
        +RunE(cmd, args)
    }
    class restart_runner_command {
        +RunE(cmd, args)
    }
    class stop_runner_command {
        +RunE(cmd, args)
    }
    class uninstall_runner_command {
        +RunE(cmd, args)
    }
    install_runner_command --> runnerOptions
    start_runner_command --> runnerOptions
    restart_runner_command --> runnerOptions
    restart_runner_command --> cleanupOptions
    stop_runner_command --> cleanupOptions
    uninstall_runner_command --> cleanupOptions
    class runInstallOrStart {
        +runInstallOrStart(cmd, runnerOptions)
    }
    class runUninstallOrStop {
        +runUninstallOrStop(cmd, cleanupOptions)
    }
    install_runner_command --> runInstallOrStart
    start_runner_command --> runInstallOrStart
    restart_runner_command --> runInstallOrStart
    restart_runner_command --> runUninstallOrStop
    stop_runner_command --> runUninstallOrStop
    uninstall_runner_command --> runUninstallOrStop
Loading

File-Level Changes

Change Details Files
Abstract shared logic for install/start and uninstall/stop actions
  • Introduce runnerOptions struct to hold common flags
  • Extract runInstallOrStart function for install-runner and start-runner
  • Introduce cleanupOptions struct and runUninstallOrStop for uninstall and stop actions
  • Refactor newInstallRunner and newUninstallRunner to delegate to shared functions
cmd/cli/commands/install-runner.go
cmd/cli/commands/uninstall-runner.go
Add start-runner, stop-runner, and restart-runner commands
  • Implement newStartRunner, newStopRunner, newRestartRunner commands
  • Register commands in root.go
  • Add command implementations invoking shared abstractions
cmd/cli/commands/start-runner.go
cmd/cli/commands/stop-runner.go
cmd/cli/commands/restart-runner.go
cmd/cli/commands/root.go
Update CLI documentation and minor comment corrections
  • Add new commands to README and reference manifests
  • Adjust port description in YAML and markdown docs
  • Add reference docs for start, stop, and restart commands
  • Correct store.Reset comment to reference Docker Engine
cmd/cli/README.md
cmd/cli/docs/reference/docker_model_install-runner.yaml
cmd/cli/docs/reference/model_install-runner.md
cmd/cli/docs/reference/model_start-runner.md
cmd/cli/docs/reference/model_stop-runner.md
cmd/cli/docs/reference/model_restart-runner.md
pkg/distribution/internal/store/store.go

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @ericcurtin, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enhances the Docker Model Runner CLI by adding dedicated commands to start and stop the model runner container. These new commands provide users with direct control over the container's state, particularly in standalone environments where Docker Desktop or a manually configured host is not in use. The changes include the command definitions, the underlying functions for container interaction, and updated documentation to reflect the new functionality.

Highlights

  • New CLI Commands: Introduced docker model start and docker model stop commands to explicitly manage the Docker Model Runner container lifecycle.
  • Container Management Logic: Implemented the core logic for starting and stopping the model runner container within the standalone package, including checks for unsupported engine kinds (Docker Desktop, Moby Manual with MODEL_RUNNER_HOST).
  • Documentation Updates: Added comprehensive documentation for the new start and stop commands, including YAML reference files and Markdown descriptions.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds Docker CLI commands to start and stop the model runner container, providing basic lifecycle management functionality.

  • Implements StartControllerContainer and StopControllerContainer functions with container lookup and state management
  • Creates new CLI commands docker model start and docker model stop with proper error handling for unsupported contexts
  • Adds comprehensive documentation files for both commands

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
cmd/cli/pkg/standalone/containers.go Adds container start/stop functions with proper error handling and status reporting
cmd/cli/commands/start-runner.go Implements CLI command for starting model runner containers
cmd/cli/commands/stop-runner.go Implements CLI command for stopping model runner containers
cmd/cli/commands/root.go Registers new start and stop commands with the CLI
cmd/cli/docs/reference/model_start.md Documentation for the start command
cmd/cli/docs/reference/model_stop.md Documentation for the stop command
cmd/cli/docs/reference/docker_model_start.yaml YAML metadata for start command documentation
cmd/cli/docs/reference/docker_model_stop.yaml YAML metadata for stop command documentation

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey there - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces docker model start and docker model stop commands to manage the lifecycle of the Docker Model Runner container. The implementation adds new cobra commands, corresponding business logic in the standalone package, and documentation.

My review has identified a critical issue in the start command's implementation that will prevent it from working as intended. There's also a high-severity issue with the stop command regarding idempotency and side effects. Additionally, I've provided some medium-severity suggestions to improve code quality and maintainability in the new command files and the container management logic.

Copy link
Contributor

@doringeman doringeman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it supposed to work to docker model stop + docker model start and have the same container back up?

@ericcurtin
Copy link
Contributor Author

@doringeman start/stop is supposed to be like install or uninstall without:

docker pull

and

docker rmi -f

if that makes sense, this is incomplete though.

@ericcurtin ericcurtin marked this pull request as draft October 14, 2025 06:13
@ericcurtin ericcurtin force-pushed the add-docker-model-start-stop-commands branch from f01d574 to 4444765 Compare October 14, 2025 20:58
@ericcurtin ericcurtin changed the title Add docker model start and stop commands Add start-runner and stop-runner commands Oct 14, 2025
@ericcurtin ericcurtin force-pushed the add-docker-model-start-stop-commands branch from 4444765 to 31693c3 Compare October 14, 2025 21:02
Copilot AI review requested due to automatic review settings October 14, 2025 21:11
@ericcurtin ericcurtin force-pushed the add-docker-model-start-stop-commands branch from 31693c3 to c9119e3 Compare October 14, 2025 21:11
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 9 out of 10 changed files in this pull request and generated 2 comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@ericcurtin ericcurtin changed the title Add start-runner and stop-runner commands Add start-runner, restart-runner and stop-runner commands Oct 14, 2025
@ericcurtin ericcurtin force-pushed the add-docker-model-start-stop-commands branch from c9119e3 to 047cad5 Compare October 14, 2025 21:15
@ericcurtin ericcurtin marked this pull request as ready for review October 14, 2025 21:16
Copilot AI review requested due to automatic review settings October 14, 2025 21:16
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 13 out of 14 changed files in this pull request and generated 2 comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey there - I've reviewed your changes - here's some feedback:

  • The repeated flag definitions for --port, --gpu, and --do-not-track across install, start, and restart commands could be DRYed by extracting a shared helper that registers runner flags and binds them to runnerOptions.
  • Consider renaming runInstallOrStart and runUninstallOrStop to more descriptive names (e.g. startOrInstallRunner, stopOrUninstallRunner) to improve readability and intent.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The repeated flag definitions for --port, --gpu, and --do-not-track across install, start, and restart commands could be DRYed by extracting a shared helper that registers runner flags and binds them to runnerOptions.
- Consider renaming runInstallOrStart and runUninstallOrStop to more descriptive names (e.g. startOrInstallRunner, stopOrUninstallRunner) to improve readability and intent.

## Individual Comments

### Comment 1
<location> `cmd/cli/docs/reference/model_restart-runner.md:4` </location>
<code_context>
+# docker model restart-runner
+
+<!---MARKER_GEN_START-->
+Start Docker Model Runner (Docker Engine only)
+
+### Options
</code_context>

<issue_to_address>
**suggestion:** Heading should say 'Restart Docker Model Runner' instead of 'Start'.

Update the heading to 'Restart Docker Model Runner (Docker Engine only)' to better reflect the command's purpose and avoid confusion.

```suggestion
Restart Docker Model Runner (Docker Engine only)
```
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@ericcurtin ericcurtin force-pushed the add-docker-model-start-stop-commands branch from 047cad5 to c8870fb Compare October 14, 2025 21:31
Copilot AI review requested due to automatic review settings October 14, 2025 21:32
@ericcurtin ericcurtin force-pushed the add-docker-model-start-stop-commands branch from c8870fb to 28b9194 Compare October 14, 2025 21:32
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 13 out of 14 changed files in this pull request and generated 5 comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@ericcurtin ericcurtin force-pushed the add-docker-model-start-stop-commands branch from 28b9194 to 0e8148e Compare October 14, 2025 21:33
Copilot AI review requested due to automatic review settings October 14, 2025 21:34
@ericcurtin ericcurtin force-pushed the add-docker-model-start-stop-commands branch 2 times, most recently from 58d5fce to 729a345 Compare October 14, 2025 21:34
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 13 out of 14 changed files in this pull request and generated 4 comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@ericcurtin ericcurtin force-pushed the add-docker-model-start-stop-commands branch 2 times, most recently from 9519b23 to 9cfaf33 Compare October 14, 2025 21:35
Copilot AI review requested due to automatic review settings October 14, 2025 21:35
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 13 out of 14 changed files in this pull request and generated no new comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@ericcurtin ericcurtin force-pushed the add-docker-model-start-stop-commands branch from 9cfaf33 to 8a440ed Compare October 14, 2025 21:36
Copilot AI review requested due to automatic review settings October 14, 2025 21:42
@ericcurtin ericcurtin force-pushed the add-docker-model-start-stop-commands branch from 8a440ed to 84f9e30 Compare October 14, 2025 21:42
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 15 out of 16 changed files in this pull request and generated 1 comment.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@ericcurtin ericcurtin force-pushed the add-docker-model-start-stop-commands branch from 84f9e30 to 1eb57a0 Compare October 14, 2025 21:44
Copilot AI review requested due to automatic review settings October 14, 2025 22:46
@ericcurtin ericcurtin force-pushed the add-docker-model-start-stop-commands branch from 1eb57a0 to fcf7653 Compare October 14, 2025 22:46
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 18 out of 19 changed files in this pull request and generated no new comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

var models bool
c := &cobra.Command{
Use: "stop-runner",
Short: "Stop Docker Model Runner",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Short: "Stop Docker Model Runner",
Short: "Stop Docker Model Runner (Docker Engine only)",

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sprinkling more of these around thanks

model-distribution-tool
model-runner
model-runner.sock
docker-model
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is docker-model?

To start, restart and stop container without pulling or removing the image.

Signed-off-by: Eric Curtin <[email protected]>
@ericcurtin ericcurtin force-pushed the add-docker-model-start-stop-commands branch from fcf7653 to edcc9e5 Compare October 15, 2025 09:36
@ericcurtin ericcurtin merged commit 58ef344 into main Oct 15, 2025
9 checks passed
@ericcurtin ericcurtin deleted the add-docker-model-start-stop-commands branch October 15, 2025 09:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants